package util;


public class DataUtil {

	public static boolean incrementArray(int[] array, int index, int limit) {
		boolean success = true;
		if (index < array.length - 1) {
			if (!incrementArray(array, index + 1, limit + 1)) {
				if (array[index] + 1 > limit) {
					success = false;
				} else {
					array[index]++;
					setValue(array, index + 1, array[index] + 1);
					success = true;
				}
			}
		} else {
			if (array[index] + 1 > limit) {
				success = false;
			} else {
				array[index]++;
				success = true;
			}
		}
		return success;
	}

	public static void setValue(int[] array, int index, int value) {
		array[index] = value;
		if (index < array.length - 1) {
			setValue(array, index + 1, value + 1);
		}
	}

}
